package blackitheima1.IntegerTest;
//字符串转数组
public class Integer4 {
    public static void main(String[] args) {
        //创建要转的字符串
        String s="11 22 33 44 55 66";
        //split 切割字符串
        String[] s1 = s.split(" ");
        //创建新的数组
        int[] arr=new int[s1.length];
        //遍历字符串数组添加元素
        for (int i = 0; i < s1.length; i++) {
            Integer integer = Integer.parseInt(s1[i]);
            arr[i]=integer;
        }
        //遍历新数组
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
    }
}
